package com.twinkle.controller;

/**
 * @title: MetadataColumnController
 * @description: 元数据接口类
 * @author: Paul
 * @date: 2023/3/14 16:01
 */

import com.twinkle.model.MetadataColumnEntity;
import com.twinkle.service.impl.MetadataColumnServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/metadata/metacolumn")
public class MetadataColumnController {

    @Autowired
    MetadataColumnServiceImpl metadataColumnService;

    @RequestMapping(value = "/getTableList", method = RequestMethod.GET)
    public List<String> getTableList(@Param("sourceId") int sourceId) {
        return metadataColumnService.getTableList(sourceId);
    }

    @RequestMapping(value = "/getTableColumns", method = RequestMethod.GET)
    public List<MetadataColumnEntity> getTableColumns(@Param("sourceId") int sourceId, @Param("tableId") String tableId) {
        return metadataColumnService.getTableColumns(sourceId, tableId);
    }
}
